public class sushu {
        // 判断一个数是否为素数
        public static boolean isPrime(int num) {
            if (num <= 1) {
                return false;
            }
            if (num <= 3) {
                return true;
            }
            if (num % 2 == 0 || num % 3 == 0) {
                return false;
            }
            int i = 5;
            while (i * i <= num) {
                if (num % i == 0 || num % (i + 2) == 0) {
                    return false;
                }
                i += 6;
            }
            return true;
        }
        public static void main(String[] args) {
            int count = 0;
            for (int i = 2; i <= 20000; i++) {
                if (isPrime(i)) {
                    System.out.print(i + " ");
                    count++;
                    if (count % 5 == 0) {
                        System.out.println();
                    }
                }
            }

        }
    }

